// 权限问题后期增加
import { get, post } from '/@/utils/http/axios'
import { BannerState } from '/@/store/modules/homePage/types'
//import { url } from 'inspector';

enum URL {
  // organAddShopCar = '/api/organ/order/addtocart/',
  // studentAddShopCar = '/api/student/cart/add/',

  createOrder = '/api/student/order/create/', // 创建订单  // 下单

  cancelOrder = '/api/order/ordercancel/', // 取消订单
  reOrder = '/api/order/recreate/', // 重新下单

  orderList = '/api/student/order/list/', //订单列表
  orderDetail = '/api/student/order/detail/', // 订单详情

  getCart = '/api/student/cart/getcart/', // 购物车
  addCart = '/api/student/cart/add/', // 添加购物车
  delCart = '/api/student/cart/del/', // 删除购物车

  payOrder = '/api/student/order/pay/', // 支付订单， 获取订单支付页面
  orderStatusQuery = '/api/order/orderstatusquery/', // 查询订单状态

}

// // 添加购物车
// const organAddShopCar = async (data) => post<any>({ url:URL.organAddShopCar, data });
// const studentAddShopCar = async (data) => post<any>({ url:URL.studentAddShopCar, data });
const createOrder = async (data) => post<any>({ url:URL.createOrder, data });

const cancelOrder = async (data) => post<any>({ url:URL.cancelOrder, data }); // 取消订单
const reOrder = async (data) => post<any>({ url:URL.reOrder, data }); // 重新下单

const orderList = async (data) => post<any>({ url: URL.orderList, data }); // 订单列表
const orderDetail = async (data) => post<any>({ url: URL.orderDetail, data }); // 订单详情

const getCart = async (data) => post<any>({ url: URL.getCart, data }); // 购物车
const addCart = async (data) => post<any>({ url: URL.addCart, data }); // 购物车
const delCart = async (data) => post<any>({ url: URL.delCart, data }); // 购物车

const payOrder = async (data) => post<any>({ url: URL.payOrder, data }); // 支付， 获取支付跳转链接
const orderStatusQuery = async (data) => post<any>({ url: URL.orderStatusQuery, data }); // 检查订单支付状态

export { 
  createOrder, cancelOrder, reOrder, 
  orderList, orderDetail, 
  getCart, addCart, delCart,
  payOrder, orderStatusQuery
}